package net.lab1024.sa.admin.module.business.erp.poo.controller;

import net.lab1024.sa.admin.module.business.erp.poo.domain.form.PuordAddForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.PuordQueryForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.PuordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.vo.PuordVO;
import net.lab1024.sa.admin.module.business.erp.poo.service.PuordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 请购单 Controller
 *
 * @Author AKITA
 * @Date 2025-07-23 17:54:05
 * @Copyright AKITA
 */

@RestController
@Tag(name = "请购单")
public class PuordController {

    @Resource
    private PuordService puordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/puord/queryPage")
    public ResponseDTO<PageResult<PuordVO>> queryPage(@RequestBody @Valid PuordQueryForm queryForm) {
        return ResponseDTO.ok(puordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/puord/add")

    public ResponseDTO<Long> add(@RequestBody @Valid PuordAddForm addForm) {
        return puordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/puord/update")
    public ResponseDTO<String> update(@RequestBody @Valid PuordUpdateForm updateForm) {
        return puordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/puord/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return puordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/puord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return puordService.delete(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/puord/info/{id}")
    public ResponseDTO<PuordVO> info(@PathVariable Long id) {
        return puordService.info(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/puord/infoUnexecute/{id}")
    public ResponseDTO<PuordVO> infoUnexecute(@PathVariable Long id) {
        return puordService.infoUnexecute(id);
    }



}
